import {ElMessage, ElMessageBox} from "element-plus";

export class DialogUtils {
    /**
     * 提示信息
     * @param title
     * @param message
     * @param options
     */
    static showMessageBox(title: string, message: string, options: any) {
        const opt = {
            type: options.type,
            confirmButtonText: options.confirmButtonText !== undefined ? options.confirmButtonText : '确定',
            cancelButtonText: options.cancelButtonText !== undefined ? options.cancelButtonText : '取消'
        }
        // @ts-ignore
        return ElMessageBox.confirm(message, title, opt);
    }

    static showWarningBox(title: string, message: string) {
        const opt = {
            type: 'warning',
            confirmButtonText: '确定',
        }

        // @ts-ignore
        return ElMessageBox.alert(message, title, opt);
    }

    /**
     * 提示错误信息
     * @param title
     * @param message
     */
    static showErrorBox(title: string, message: string) {
        const opt = {
            type: 'error',
            confirmButtonText: '确定',
        }

        // @ts-ignore
        return ElMessageBox.alert(message, title, opt);
    }

    static showMessageInfo(message: string) {
        ElMessage({
            message: message,
            type: 'success',
        });
    }
}
